{include file="header"}
<script type="text/javascript" src="*ADMIN*/js/pinyin.js"></script>
<style type="text/css" media="all">
.upfujian {
    border-radius: 1.25rem;
    position: absolute;
    top: 5px;
    right: 6px;
    height: 30px;
    line-height: 30px;
    width: 100px;
}
</style> 
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;" ng-app="" >
            <!--表单提交-->
            {if get('id',0) == '0'}
            <form class="layui-form" url="{:url('admin/api/add')}" t_url="javascript:parent.location.reload();">
            {else /}
                <form class="layui-form" url="{:url('admin/api/edit')}" t_url="javascript:parent.location.reload();">
                <input type="hidden" name="id" value="{$c.id}">
            {/if}
                    <input type="hidden" name="model" value="cate">
                    <input type="hidden" name="wz" value="{:get('wz',1)}">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">选择分类</label>
                            <div class="layui-input-inline">
                                <select name="tid" lay-verify="required" >
                                    <option value="0">顶级分类</option>
                                    {foreach name=":fun_S('cate',array('tid'=>0),'px desc','1000',1)" item="v" key="k"}
                                    <option value="{$v.id}" {if $c.tid == $v.id}selected="选择"{/if}{if $v['id'] == input('id')}disabled=""{/if}>{$v.name}</option>
                                    {volist name=":fun_s('cate',array('tid'=>$v['id']),'px desc',100,1)" id="vo"}
                                    <option value="{$vo.id}" disabled="禁用">——{$vo.name}</option>
                                    {/volist}  
                                    {/foreach} 
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name"  id="myInput" oninput="myFunction()" value="{$c.name}" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">别名</label>
                        <div class="layui-input-block">
                            <input type="text" name="alias" value="{$c.alias}" lay-verify="required" autocomplete="off" placeholder="请输入别名" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">图标</label>
                            <div class="layui-input-block">
                                <input type="text" name="pic" id="fujian" value="{$c.pic}" placeholder="上传图标" autocomplete="off" class="layui-input">
                                <button type="button" class="layui-btn layui-btn-normal up upfujian" up="fujian">上传</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="open" value="1" title="显示" {if dingyi($c.open,1)==1 }checked="" {/if}>
                            <input type="radio" name="open" value="0" title="隐藏" {if dingyi($c.open,1)==0 }checked="" {/if}>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">导航显示</label>
                        <div class="layui-input-block">
                            <input type="radio" name="header" value="1" title="显示" {if dingyi($c.header,1)==1 }checked="" {/if}>
                            <input type="radio" name="header" value="0" title="隐藏" {if dingyi($c.header,1)==0 }checked="" {/if}>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">投稿</label>
                        <div class="layui-input-block">
                            <input type="radio" name="tougao" value="1" title="支持" {if dingyi($c.tougao,1)==1 }checked="" {/if}>
                            <input type="radio" name="tougao" value="0" title="不能" {if dingyi($c.tougao,1)==0 }checked="" {/if}>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">关键字</label>
                        <div class="layui-input-block">
                            <input type="text" name="keywords" value="{$c.keywords}" autocomplete="off" placeholder="请输入seo关键字" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">描述</label>
                        <div class="layui-input-block">
                            <textarea name="description" placeholder="seo描述" class="layui-textarea">{$c.description}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="L_title" class="layui-form-label">排序</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <input type="number" name="px" value="{:dingyi($c.px,0)}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-layout-admin">
                        <div class="layui-input-block">
                            <div class="layui-footer" style="left: 0;">
                                <button class="layui-btn" lay-submit="" lay-filter="cms">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </div>
                </form>
        </div>
    </div>
</div>
<script>
function myFunction() {
    var x = document.getElementById("myInput").value;
    $("input[name=alias]").val(pinyin.getFullChars($("#myInput").val()));
     
}
</script>
{include file="footer"}